/**
 */
package mvc_generator.mVCGenerator.impl;

import mvc_generator.mVCGenerator.AffectableExpression;
import mvc_generator.mVCGenerator.MVCGeneratorPackage;
import mvc_generator.mVCGenerator.ReturnExpression;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Return Expression</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link mvc_generator.mVCGenerator.impl.ReturnExpressionImpl#getReturnedExpression <em>Returned Expression</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ReturnExpressionImpl extends ExpressionImpl implements ReturnExpression
{
  /**
   * The cached value of the '{@link #getReturnedExpression() <em>Returned Expression</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getReturnedExpression()
   * @generated
   * @ordered
   */
  protected AffectableExpression returnedExpression;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ReturnExpressionImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MVCGeneratorPackage.Literals.RETURN_EXPRESSION;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public AffectableExpression getReturnedExpression()
  {
    return returnedExpression;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetReturnedExpression(AffectableExpression newReturnedExpression, NotificationChain msgs)
  {
    AffectableExpression oldReturnedExpression = returnedExpression;
    returnedExpression = newReturnedExpression;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION, oldReturnedExpression, newReturnedExpression);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setReturnedExpression(AffectableExpression newReturnedExpression)
  {
    if (newReturnedExpression != returnedExpression)
    {
      NotificationChain msgs = null;
      if (returnedExpression != null)
        msgs = ((InternalEObject)returnedExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION, null, msgs);
      if (newReturnedExpression != null)
        msgs = ((InternalEObject)newReturnedExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION, null, msgs);
      msgs = basicSetReturnedExpression(newReturnedExpression, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION, newReturnedExpression, newReturnedExpression));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION:
        return basicSetReturnedExpression(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION:
        return getReturnedExpression();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION:
        setReturnedExpression((AffectableExpression)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION:
        setReturnedExpression((AffectableExpression)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MVCGeneratorPackage.RETURN_EXPRESSION__RETURNED_EXPRESSION:
        return returnedExpression != null;
    }
    return super.eIsSet(featureID);
  }

} //ReturnExpressionImpl
